/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package metricmaster.gui.raw;

import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;
import metricmaster.model.RawHoursData;

/**
 *
 * @author markblanda
 */
public class RawLaborTableModel extends AbstractTableModel {

    private String[] columnNames = {"Data Date", "Shop Order", "Work Package",
        "Employee Name", "Employee Badge", "Supervisor Badge", "Dept",
        "Dept Served", "Non Paid OT", "Paid OT", "Total Hours",
        "Pay Type", "Source Type", "Pay Code", "Week Ending"
    };
    private final int DATA_DATECOL = 0;
    private final int SHOP_ORDER = 1;
    private final int WORK_PACKAGE = 2;
    private final int EMPLOYEE_NAME = 3;
    private final int EMPLOYEE_BADGE = 4;
    private final int SUPERVISOR_BADGE = 5;
    private final int DEPT = 6;
    private final int DEPT_SERVED = 7;
    private final int NON_PAID_OT = 8;
    private final int PAID_OT = 9;
    private final int TOTAL_HOURS = 10;
    private final int PAY_TYPE = 11;
    private final int SOURCE_TYPE = 12;
    private final int PAY_CODE = 13;
    private final int WEEK_ENDING = 14;
    private ArrayList<RawHoursData> data;

    public RawLaborTableModel() {
        data = new ArrayList<>();

    }

    @Override
    public String getColumnName(int col) {
        return columnNames[col];
    }

    @Override
    public int getRowCount() {
        return data.size();
    }

    @Override
    public int getColumnCount() {
        return columnNames.length;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        RawHoursData raw = data.get(rowIndex);
        Object value = null;

        switch (columnIndex) {
            case DATA_DATECOL:
                value = raw.getDataDate();
                break;
            case SHOP_ORDER:
                value = raw.getShopOrder();
                break;
            case WORK_PACKAGE:
                value = raw.getWorkPackage();
                break;
            case EMPLOYEE_NAME:
                value = raw.getEmployeeName();
                break;
            case EMPLOYEE_BADGE:
                value = raw.getEmployeeBadge();
                break;
            case SUPERVISOR_BADGE:
                value = raw.getSupervisorBadge();
                break;
            case DEPT:
                value = raw.getDept();
                break;
            case DEPT_SERVED:
                value = raw.getDeptServed();
                break;
            case NON_PAID_OT:
                value = raw.getNonPaidOT();
                break;
            case PAID_OT:
                value = raw.getPaidOT();
                break;
            case TOTAL_HOURS:
                value = raw.getTotalHours();
                break;
            case PAY_TYPE:
                value = raw.getPayType();
                break;
            case SOURCE_TYPE:
                value = raw.getSourceType();
                break;
            case PAY_CODE:
                value = raw.getPayCode();
                break;
            case WEEK_ENDING:
                value = raw.getWeekEnding();
                break;
        }

        return value;
    }
}
